package com.fine.demo.keyboard

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.ViewGroup
import android.widget.EditText

class MainActivity : AppCompatActivity(), IEditText.OnKeyboardListener {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val edit = findViewById<IEditText>(R.id.edit)
        val keyboardView = findViewById<MKeyboardView>(R.id.keyboard_view)
        val viewGroup = findViewById<ViewGroup>(R.id.view_group)

        edit.setEditView(viewGroup, keyboardView, false)
        edit.setOnKeyboardListener(this)
    }

    override fun onHide(isCompleted: Boolean) {
        Log.i("Fine", "onHide---->$isCompleted")
    }

    override fun onShow() {
        Log.i("Fine", "onShow---->onShow")
    }

    override fun onPress(primaryCode: Int) {
        Log.i("Fine", "---->${primaryCode.toChar()}")
    }
}
